#include <iostream>

using namespace std;

int *SimpleBucketSort(int *UnsortedArray, int length);

int UnsortedArray[10] = {1, 5, 2, 2, 4, 6, 1, 7, 9, 0};
int length = 10;

int *SimpleBucketSort(int *UnsortedArray, int length)
{
	int *Bucket = (int *)malloc(length * sizeof(int));
	if (Bucket)
	{
		memset(Bucket, 0, length * sizeof(int));
		while (length--)
			(*(Bucket + (*(UnsortedArray + length))))++;
		return Bucket;
	}
	else
	{
		return NULL;
	}
}

// int main()
// {
// 	int * Bucket = SimpleBucketSort(UnsortedArray, length);
// 	int it = length;
// 	while (it--) cout << "Bucket[" << length - it - 1 << "]" << Bucket[length - it - 1] << endl;
// 	return 0;
// }